package org.jackysoft.entity;
import javax.persistence.Entity;
import javax.persistence.Transient;

import org.jackysoft.annotations.Form;
import org.jackysoft.annotations.FormEncType;
import org.jackysoft.entity.User;
import org.joda.time.DateTime;
import org.springframework.data.annotation.PersistenceConstructor;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true) 
@Form(id="HistoryFileItemForm",label="HistoryFileItem 编辑",enctype=FormEncType.NORMAL)
public class HistoryFileItem extends FileItem {
   
    /**
	 * 
	 */
	private static final long serialVersionUID = -867166330989009991L;

	private String originId;

	private byte [] data;
	@PersistenceConstructor
	public HistoryFileItem(){
		
	}

	
	public HistoryFileItem(String id,String title,String fileType,DateTime createDate,User owner){
		this.id = id;
		this.title = title;
		this.fileType = fileType;
		this.createTime = createDate;
		this.owner = owner;
	}
	
	/**原始文件编号*/
	public String getOriginId() {
		return originId;
	}

	public void setOriginId(String originId) {
		this.originId = originId;
	}


	@Transient
	public byte [] getData() {
		return data;
	}


	public void setData(byte [] data) {
		this.data = data;
	}  
	
	@Transient
	public String getLastDate(){
		return createTime.toString("yyyy-MM-dd HH:mm:ss E");
	}
	


}